home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / socket / miami3 / miamisdk / netinclude / sys / syslog.h < prev    next >
C/C++ Source or Header  |  1998-05-24  |  4KB  |  130 lines

  1. #ifndef _SYS_SYSLOG_H_
  2. #define _SYS_SYSLOG_H_
  3.  
  4. /*
  5.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  6.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  7.  * (0-big number).  Both the priorities and the facilities map roughly
  8.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  9.  * included in this file.
  10.  *
  11.  * priorities (these are ordered)
  12.  */
  13. #define    LOG_EMERG    0    /* system is unusable */
  14. #define    LOG_ALERT    1    /* action must be taken immediately */
  15. #define    LOG_CRIT    2    /* critical conditions */
  16. #define    LOG_ERR        3    /* error conditions */
  17. #define    LOG_WARNING    4    /* warning conditions */
  18. #define    LOG_NOTICE    5    /* normal but significant condition */
  19. #define    LOG_INFO    6    /* informational */
  20. #define    LOG_DEBUG    7    /* debug-level messages */
  21.  
  22. #define    LOG_PRIMASK    0x07    /* mask to extract priority part (internal) */
  23.                 /* extract priority */
  24. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  25. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  26.  
  27. #ifdef SYSLOG_NAMES
  28. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  29.                 /* mark "facility" */
  30. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  31. typedef struct _code {
  32.     char    *c_name;
  33.     long    c_val;
  34. } CODE;
  35.  
  36. CODE prioritynames[] = {
  37.     "alert",    LOG_ALERT,
  38.     "crit",        LOG_CRIT,
  39.     "debug",    LOG_DEBUG,
  40.     "emerg",    LOG_EMERG,
  41.     "err",        LOG_ERR,
  42.     "error",    LOG_ERR,        /* DEPRECATED */
  43.     "info",        LOG_INFO,
  44.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  45.     "notice",    LOG_NOTICE,
  46.     "panic",     LOG_EMERG,        /* DEPRECATED */
  47.     "warn",        LOG_WARNING,        /* DEPRECATED */
  48.     "warning",    LOG_WARNING,
  49.     NULL,        -1,
  50. };
  51. #endif
  52.  
  53. /* facility codes */
  54. #define    LOG_KERN    (0<<3)    /* kernel messages */
  55. #define    LOG_USER    (1<<3)    /* random user-level messages */
  56. #define    LOG_MAIL    (2<<3)    /* mail system */
  57. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  58. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  59. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  60. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  61. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  62. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  63. #define    LOG_CRON    (9<<3)    /* clock daemon */
  64. #define    LOG_AUTHPRIV    (10<<3)    /* security/authorization messages (private) */
  65. #define    LOG_FTP        (11<<3)    /* ftp daemon */
  66.  
  67.     /* other codes through 15 reserved for system use */
  68. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  69. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  70. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  71. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  72. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  73. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  74. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  75. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  76.  
  77. #define    LOG_NFACILITIES    24    /* current number of facilities */
  78. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  79.                 /* facility of pri */
  80. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  81.  
  82. #ifdef SYSLOG_NAMES
  83. CODE facilitynames[] = {
  84.     "auth",        LOG_AUTH,
  85.     "authpriv",    LOG_AUTHPRIV,
  86.     "cron",     LOG_CRON,
  87.     "daemon",    LOG_DAEMON,
  88.     "ftp",        LOG_FTP,
  89.     "kern",        LOG_KERN,
  90.     "lpr",        LOG_LPR,
  91.     "mail",        LOG_MAIL,
  92.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  93.     "news",        LOG_NEWS,
  94.     "security",    LOG_AUTH,        /* DEPRECATED */
  95.     "syslog",    LOG_SYSLOG,
  96.     "user",        LOG_USER,
  97.     "uucp",        LOG_UUCP,
  98.     "local0",    LOG_LOCAL0,
  99.     "local1",    LOG_LOCAL1,
  100.     "local2",    LOG_LOCAL2,
  101.     "local3",    LOG_LOCAL3,
  102.     "local4",    LOG_LOCAL4,
  103.     "local5",    LOG_LOCAL5,
  104.     "local6",    LOG_LOCAL6,
  105.     "local7",    LOG_LOCAL7,
  106.     NULL,        -1,
  107. };
  108. #endif
  109.  
  110. /*
  111.  * arguments to setlogmask.
  112.  */
  113. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  114. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  115.  
  116. /*
  117.  * Option flags for openlog.
  118.  *
  119.  * LOG_ODELAY no longer does anything.
  120.  * LOG_NDELAY is the inverse of what it used to be.
  121.  */
  122. #define    LOG_PID        0x01    /* log the pid with each message */
  123. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  124. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  125. #define    LOG_NDELAY    0x08    /* don't delay open */
  126. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  127. #define    LOG_PERROR    0x20    /* log to stderr as well */
  128.  
  129. #endif
  130.